const TOKEN_KEY = 'token';
const USER_KEY = 'userId';

const isLogin = () => {
  return !!localStorage.getItem(TOKEN_KEY);
};

const getToken = () => {
  return localStorage.getItem(TOKEN_KEY);
};

const setToken = (token: string) => {
  localStorage.setItem(TOKEN_KEY, token);
};

const clearToken = () => {
  localStorage.removeItem(TOKEN_KEY);
};

const getUserId = () => {
  return localStorage.getItem(USER_KEY);
};

const setUser = (id: string) => {
  localStorage.setItem(USER_KEY, id);
};

const clearUser = () => {
  localStorage.removeItem(USER_KEY);
};

export { isLogin, getToken, setToken, clearToken,getUserId,setUser,clearUser };
